package com.shuyun.xxx.guava.algorithm;

/**
 * Created by goodb on 2017/5/6.
 */
public class Classify {
    public static void jiTuTongLong(int foot, int head){
        int chicken = 0;
        int rabbit = 0;
        for(chicken = 0; chicken <= head; chicken++){
            rabbit = head - chicken;
            if(rabbit * 4 + chicken * 2 == foot){
                System.out.println("鸡有:" + chicken + ", 兔有:" + rabbit);
            }
        }
    }

    public static int fibonacci(int n){
        /*if(n == 1 || n == 2){
            return 1;
        }else{
            return fibonacci(n - 2) + fibonacci(n - 1);
        }*/
        int[] arr = new int[n];
        arr[0] = 1;
        arr[1] = 1;
        for(int i = 2; i < n; i++){
            arr[i] = arr[i - 1] + arr[i - 2];
        }
        return arr[n];
    }

    public static int factorial(int n){
        if(n <= 1){
            return 1;
        }else{
            return n * factorial(n - 1);
        }
    }

    public static void main(String[] args) {
        /*Scanner sc = new Scanner(System.in);
        System.out.println("输入头");
        int head = sc.nextInt();
        System.out.println("输入脚");
        int foot = sc.nextInt();
        jiTuTongLong(foot, head);*/

//        System.out.println(fibonacci(sc.nextInt()));

//        System.out.println(factorial(sc.nextInt()));
        String s = "ab**cd**e**12";
        char[] chars = s.toCharArray();
        int i, j = chars.length - 1;
        for(i = j; j >= 0; j--){
            if(chars[i] != '*'){
                i--;
            }else if(chars[j] != '*'){
                chars[i] = chars[j];
                chars[j] = '*';
                i--;
            }
        }
        for(int k = 0; k < chars.length; k++){
            System.out.print(chars[k]);
        }
    }
}
